//引入请求函数
import request from "@/utils/request.ts";
import { requestHttp } from "@/utils/request.ts";

//引入类型约束
import type {  } from "./type.ts";

/**
 * 登录相关的api
 */



/**
 * 登录获取验证码
 */
export const reqCaptchaImgCode = () => {
    return requestHttp<any>({
        url:"/captcha/picture/base64",
        method:"get"
    })
}

/**
 * 平台会员用户进行登录(支持 用户名+密码+验证码  或者  用户手机+密码+验证码)
 * userInfo = {username?:"",phone?:"",password:"",captchaCode:""}
 */
export const reqUserLogin = (userInfoForm) => {
    let params = {password:userInfoForm.password,captchaCode:userInfoForm.captchaCode};
    if(userInfoForm.username !== "") {
        params.username = userInfoForm.username;
    } else {
        params.phone = userInfoForm.phone;
    }
    return requestHttp<any>({
        url:"/reception/login",
        method:"post",
        data:params
    })
}